﻿using System;
using System.Data;
using System.Collections.Generic;
using SERP.DAO;
namespace SERP.Controllers{
public class PersonTypesControllerBase : Controller{
	public PersonTypesControllerBase()
		: base()
	{
	}
	private static PersonTypesDAO _Service; 
	public static PersonTypesDAO Service{
		get{
			if(_Service==null)
				_Service = new PersonTypesDAO();
			return _Service;
		}
		set{
			_Service = value;
		}
	}
    //Copy data from data row in grid to object
    public PersonTypesEntity MapDataRowToObject(DataRow row){
		PersonTypesEntity o = new PersonTypesEntity();
		 if(!row.IsNull("PersonTypeId"))
			o.PersonTypeId=ConvertInt(row["PersonTypeId"]);
		 o.TypeName=Convert.ToString(row["TypeName"]);
		 o.Note=Convert.ToString(row["Note"]);
		 if(!row.IsNull("PersonTypeId"))
		    o.PersonTypeId=(Int32)(row["PersonTypeId"]);
		 return o;
    }
	//Copy data from object to data row in grid    
    public void MapObjectToDataRow(PersonTypesEntity o,DataRow row){
		row["PersonTypeId"]=o.PersonTypeId;
		row["TypeName"]=o.TypeName;
		row["Note"]=o.Note;
		row["PersonTypeId"]=o.PersonTypeId;
    }
}
}
